<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../lib/jsunit/app/jsUnitCore.js"></script>
<script type="text/javascript" src="../lib/prototype.js"></script>
<script type="text/javascript" src="../src/base.js"></script>
<script type="text/javascript" src="../src/wp.js"></script>
</head>
<body>
<script type="text/javascript">
var popup1, popup2, popup3;
function setUpPage() {
	popup1 = new Antiquity.WPL.Popup("popup1");
	popup2 = new Antiquity.WPL.Popup("popup2", {
		offset: {
			x: 10,
			y: 10
		},
		anchor: {
			target: Antiquity.WPL.Anchor.TOP_LEFT,
			popup: Antiquity.WPL.Anchor.BOTTOM_RIGHT
		},
		alwaysUpdate: true,
		showDelay: 0.5,
		hideDelay: 0.5,
		type: Antiquity.WPL.Type.DIALOG,
		showEvent: "click",
		hideEvent: "click"
	});
	popup3 = new Antiquity.WPL.Popup("popup3", {}, "anchor");
	setUpPageStatus = "complete";
}
function testWPInit() {
	assertEquals("popup1's popup element should be 'popup1'.", popup1.popupElm.id, "popup1");
	assertEquals("popup2's popup element should be 'popup2'.", popup2.popupElm.id, "popup2");
	assertEquals("popup3's popup element should be 'popup3'.", popup3.popupElm.id, "popup3");

	assertEquals("popup1's options should be overwritten.", popup1.options.offset.x, 0);
	assertEquals("popup1's options should be overwritten.", popup1.options.anchor.target, Antiquity.WPL.Anchor.BOTTOM_RIGHT);
	assertFalse("popup1's options should be overwritten.", popup1.options.alwaysUpdate);

	assertEquals("popup2's options should be overwritten.", popup2.options.offset.x, 10);
	assertEquals("popup2's options should be overwritten.", popup2.options.anchor.target, Antiquity.WPL.Anchor.TOP_LEFT);
	assertTrue("popup2's options should be overwritten.", popup2.options.alwaysUpdate);
	
}
function testWPUninstall() {
	popup1.uninstall();
	assertEquals("popup1's anchor elements are now removed", popup1.anchorElms.length, 0);
	assertNull("popup1's popup elements is now removed", popup1.popupElm);
	assertEquals("popup1's state is now set to destroyed", popup1.state,Antiquity.WPL.State.DESTROYED);
}
</script>
<a href="#" id="anchor">anchor</a>
<div id="popup1">tooltip1</div>
<div id="popup2">tooltip2</div>
<div id="popup3">tooltip3</div>
</body>
</html>